home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1893 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.3 KB

  1. Path: conan.ids.net!scarney
  2. From: scarney@conan.ids.net (scarney)
  3. Newsgroups: comp.lang.c,comp.lang.c++,comp.lang.perl
  4. Subject: Stupid array problems
  5. Date: 13 Jan 1996 22:21:51 GMT
  6. Organization: IDS World Network Internet Access Service, (401) 885-4243
  7. Message-ID: <4d9b9v$14n@paperboy.ids.net>
  8. NNTP-Posting-Host: conan.ids.net
  9.  
  10. Ok, I've been having what I thought would be a simple problem but no one 
  11. seems to quite figure out. I Have an array of strings, both the key and 
  12. the string being pointers. Putting information onto the array is like a 
  13. stack.  My problem comes in the removal of information from it. Popping 
  14. from a stack only pulls the lastelement out of the array, I want to pull 
  15. any element out. Destroying the data isn't the hard part because I just 
  16. blow up the pointers...the problem is that the indexing for the array 
  17. gets kind of screwy. If I have an array organized by integers with 
  18. elements 1 2 3 4 5 6 7 8, if I decided to kill element #4 I'm going to 
  19. have an array of 1 2 3 5 6 7 8, and as time goes on its going to get more 
  20. screwy. Is there an easy way to delete an element while preserving some 
  21. semblance of sequence in the array indexing? In Perl I'd use the splice() 
  22. command...is there anything similar in C/C++?
  23.  
  24. I get the feeling I'm looking at this from a completely wrong 
  25. perspective, so don't flame me if I am...
  26.  
  27. Thanks.
  28. -Seth
  29.  
  30.